/**
 * <copyright>
 * </copyright>
 *
 */
package de.sabram.upb.specs.lido.impl;

import de.sabram.upb.specs.lido.DefAttr;
import de.sabram.upb.specs.lido.ExpressionDep;
import de.sabram.upb.specs.lido.LidoPackage;
import de.sabram.upb.specs.lido.Loop;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Def Attr</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.sabram.upb.specs.lido.impl.DefAttrImpl#getExpressionDep <em>Expression Dep</em>}</li>
 *   <li>{@link de.sabram.upb.specs.lido.impl.DefAttrImpl#getLoop <em>Loop</em>}</li>
 *   <li>{@link de.sabram.upb.specs.lido.impl.DefAttrImpl#getChainexpressionDep <em>Chainexpression Dep</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DefAttrImpl extends AttrCompImpl implements DefAttr
{
  /**
   * The cached value of the '{@link #getExpressionDep() <em>Expression Dep</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getExpressionDep()
   * @generated
   * @ordered
   */
  protected ExpressionDep expressionDep;

  /**
   * The cached value of the '{@link #getLoop() <em>Loop</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getLoop()
   * @generated
   * @ordered
   */
  protected Loop loop;

  /**
   * The cached value of the '{@link #getChainexpressionDep() <em>Chainexpression Dep</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getChainexpressionDep()
   * @generated
   * @ordered
   */
  protected ExpressionDep chainexpressionDep;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected DefAttrImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return LidoPackage.Literals.DEF_ATTR;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ExpressionDep getExpressionDep()
  {
    return expressionDep;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetExpressionDep(ExpressionDep newExpressionDep, NotificationChain msgs)
  {
    ExpressionDep oldExpressionDep = expressionDep;
    expressionDep = newExpressionDep;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LidoPackage.DEF_ATTR__EXPRESSION_DEP, oldExpressionDep, newExpressionDep);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setExpressionDep(ExpressionDep newExpressionDep)
  {
    if (newExpressionDep != expressionDep)
    {
      NotificationChain msgs = null;
      if (expressionDep != null)
        msgs = ((InternalEObject)expressionDep).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LidoPackage.DEF_ATTR__EXPRESSION_DEP, null, msgs);
      if (newExpressionDep != null)
        msgs = ((InternalEObject)newExpressionDep).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LidoPackage.DEF_ATTR__EXPRESSION_DEP, null, msgs);
      msgs = basicSetExpressionDep(newExpressionDep, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LidoPackage.DEF_ATTR__EXPRESSION_DEP, newExpressionDep, newExpressionDep));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Loop getLoop()
  {
    return loop;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetLoop(Loop newLoop, NotificationChain msgs)
  {
    Loop oldLoop = loop;
    loop = newLoop;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LidoPackage.DEF_ATTR__LOOP, oldLoop, newLoop);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setLoop(Loop newLoop)
  {
    if (newLoop != loop)
    {
      NotificationChain msgs = null;
      if (loop != null)
        msgs = ((InternalEObject)loop).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LidoPackage.DEF_ATTR__LOOP, null, msgs);
      if (newLoop != null)
        msgs = ((InternalEObject)newLoop).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LidoPackage.DEF_ATTR__LOOP, null, msgs);
      msgs = basicSetLoop(newLoop, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LidoPackage.DEF_ATTR__LOOP, newLoop, newLoop));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ExpressionDep getChainexpressionDep()
  {
    return chainexpressionDep;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetChainexpressionDep(ExpressionDep newChainexpressionDep, NotificationChain msgs)
  {
    ExpressionDep oldChainexpressionDep = chainexpressionDep;
    chainexpressionDep = newChainexpressionDep;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LidoPackage.DEF_ATTR__CHAINEXPRESSION_DEP, oldChainexpressionDep, newChainexpressionDep);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setChainexpressionDep(ExpressionDep newChainexpressionDep)
  {
    if (newChainexpressionDep != chainexpressionDep)
    {
      NotificationChain msgs = null;
      if (chainexpressionDep != null)
        msgs = ((InternalEObject)chainexpressionDep).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LidoPackage.DEF_ATTR__CHAINEXPRESSION_DEP, null, msgs);
      if (newChainexpressionDep != null)
        msgs = ((InternalEObject)newChainexpressionDep).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LidoPackage.DEF_ATTR__CHAINEXPRESSION_DEP, null, msgs);
      msgs = basicSetChainexpressionDep(newChainexpressionDep, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LidoPackage.DEF_ATTR__CHAINEXPRESSION_DEP, newChainexpressionDep, newChainexpressionDep));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case LidoPackage.DEF_ATTR__EXPRESSION_DEP:
        return basicSetExpressionDep(null, msgs);
      case LidoPackage.DEF_ATTR__LOOP:
        return basicSetLoop(null, msgs);
      case LidoPackage.DEF_ATTR__CHAINEXPRESSION_DEP:
        return basicSetChainexpressionDep(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case LidoPackage.DEF_ATTR__EXPRESSION_DEP:
        return getExpressionDep();
      case LidoPackage.DEF_ATTR__LOOP:
        return getLoop();
      case LidoPackage.DEF_ATTR__CHAINEXPRESSION_DEP:
        return getChainexpressionDep();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case LidoPackage.DEF_ATTR__EXPRESSION_DEP:
        setExpressionDep((ExpressionDep)newValue);
        return;
      case LidoPackage.DEF_ATTR__LOOP:
        setLoop((Loop)newValue);
        return;
      case LidoPackage.DEF_ATTR__CHAINEXPRESSION_DEP:
        setChainexpressionDep((ExpressionDep)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case LidoPackage.DEF_ATTR__EXPRESSION_DEP:
        setExpressionDep((ExpressionDep)null);
        return;
      case LidoPackage.DEF_ATTR__LOOP:
        setLoop((Loop)null);
        return;
      case LidoPackage.DEF_ATTR__CHAINEXPRESSION_DEP:
        setChainexpressionDep((ExpressionDep)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case LidoPackage.DEF_ATTR__EXPRESSION_DEP:
        return expressionDep != null;
      case LidoPackage.DEF_ATTR__LOOP:
        return loop != null;
      case LidoPackage.DEF_ATTR__CHAINEXPRESSION_DEP:
        return chainexpressionDep != null;
    }
    return super.eIsSet(featureID);
  }

} //DefAttrImpl
